package com.zj.leetcode.easy.greed;

import java.util.HashSet;

/**
 * @program: algorithm
 * @description:
 * 分糖果
 * 575 distribute-candies
 * @author: Zhang Bo
 * @create: 2022-01-14 17:05
 **/
public class DistributeCandies{
    public static void main(String[] args) {
        Solution solution = new DistributeCandies().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int distributeCandies(int[] candyType) {

            HashSet<Integer> set = new HashSet<>();
            for (Integer temp : candyType) {
                set.add(temp);
            }
            int count = candyType.length / 2;
            return Math.min(set.size(), count);

        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
